<?php
require_once("../inc/conn.php");
require_once("../inc/session.php");
//接收传递来的值
$name=$_POST["name"];
$pass=$_POST["pass"];
$pass1=$_POST["pass1"];
$level=$_POST["level"];
//比较密码
if($pass==$pass1){
	//定义SQL语句  实现写入
$sql="insert into admin(name,pass,level,dt) values('".$name."','".$pass."','".$level."',now())";
//执行sql语句
$rs=$conn->query($sql);

if($rs){
	echo "<script>alert('写入成功！');location.href='adminlist.php';</script>";
}else{
	echo "<script>alert('写入失败！');location.href='addadmin.php';</script>";

}
}else{
	echo "<script>window.alert('密码不相符！！'); location.href='addadmin.php';</script>";
}

?>